﻿#include "singlecapcmdframe.h"

using namespace IGBTProtocol;

SingleCapCmdFrame::SingleCapCmdFrame()
    : CmdFrame()
{
    _capturePeriodUs = 100;
}

SingleCapCmdFrame::SingleCapCmdFrame(CmdType cmdType, unsigned short capturePeriodUs)
    : CmdFrame(cmdType, 5)
{
    _capturePeriodUs = capturePeriodUs;
}

unsigned int SingleCapCmdFrame::frame(QByteArray* buff, bool tail)
{
    Q_UNUSED(tail);

    CmdFrame::frame(buff);

    buff->append(_capturePeriodUs & 0x00ff);
    buff->append(_capturePeriodUs >> 8);

    buff->append(calcCRC(buff,_dataSize + 9));
    return 10+_dataSize;
}
